package com.chat.system.entity.domain;

import java.util.HashMap;

public class Res extends HashMap<String ,Object> {
    public static final String SUCCESS_CODE = "200";
    public static final String ERROR_CODE = "500";
    public static final String SUCCESS_MSG = "操作成功";
    public static final String ERROR_MSG = "操作失败";

    public static final String CODE = "code";
    public static final String MSG = "msg";

    private Res () {

    }

    public static Res success() {
        final Res res = new Res();
        res.put(CODE,SUCCESS_CODE);
        res.put(MSG,SUCCESS_MSG);
        return res;
    }
    public static Res success(String msg) {
        final Res res = new Res();
        res.put(CODE,SUCCESS_CODE);
        res.put(MSG,msg);
        return res;
    }
    public static Res error() {
        final Res res = new Res();
        res.put(CODE,ERROR_CODE);
        res.put(MSG,ERROR_MSG);
        return res;
    }
    public static Res error(String msg) {
        final Res res = new Res();
        res.put(CODE,ERROR_CODE);
        res.put(MSG,msg);
        return res;
    }

}
